package com.ck.daoImpl;

import java.util.List;

import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import com.ck.dao.StudentExamDAO;
import com.ck.domain.StudentExam;

public class StudentExamDAOImpl extends SqlMapClientDaoSupport implements StudentExamDAO {
	
	public List<StudentExam> getUnfinishedStudentExamForStudent(Integer studentID){
		return (List<StudentExam>)getSqlMapClientTemplate().queryForList("getUnfinishedStudentExamForStudent", studentID);
	}
	
	public List<StudentExam> getFinishedStudentExamForStudent(Integer studentID){
		return (List<StudentExam>)getSqlMapClientTemplate().queryForList("getFinishedStudentExamForStudent", studentID);
	}
	
	public List<StudentExam> getAbsentStudentExamForStudent(Integer studentID){
		return (List<StudentExam>)getSqlMapClientTemplate().queryForList("getAbsentStudentExamForStudent", studentID);
	}
	
	public void addNewStudentExam(StudentExam studentExam) {
		getSqlMapClientTemplate().insert("addNewStudentExam", studentExam);
	}

	public void deleteStudentExamByExam(Integer exam) {
		getSqlMapClientTemplate().delete("deleteStudentExamByExam", exam);
	}

	public void updateStudentExamForHandInPaper(StudentExam studentExam) {
		getSqlMapClientTemplate().update("updateStudentExamForHandInPaper", studentExam);
	}

}
